home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / do_for21.zip / DO-FOR.DOC next >
Text File  |  1991-08-18  |  11KB  |  259 lines

  1. DO-FOR  Version 2.1
  2.  
  3. NOTE:  This program is offered as a "FREEBIE"
  4.        NO donations are requested or accepted.  I've used enough other
  5.          people's freebies that this is offered as only a partial repayment
  6.          for their time and effort.  My only request is that if you have
  7.          any suggestions, bug reports, or comments (I LOVE comments!),
  8.          please drop me a line or leave a message for me on Compuserve
  9.  
  10.          ID # (72317,2751).
  11.  
  12.          You can also write or call me at the address/phone number listed at
  13.          the bottom of this documentation.
  14.  
  15.        You might also want to check for another "DO" utility, called DO-ONCE.
  16.          This other utility allows you to run a program only once a
  17.          day/week/month, automating some of the more common "once in a while"
  18.          type disk maintenance chores, etc.
  19.  
  20.  
  21. ------------------ PURPOSE AND FUNCTION OF PROGRAM ----------------
  22.  
  23. This program was designed to be a faster and more flexible replacement for
  24. the DOS batch file command  FOR.  It allows you, in effect, to add a
  25. "wildcard" capability to any program, batch file, or DOS command.  It also
  26. gives a more capable set of criteria for choosing a wildcard than the simple
  27. DOS  *  and  ?  offer.  You can choose by the file attribute or file date
  28. as well as by the standard   *  and  ?  criteria; alternately, you can create
  29. a list of files to be operated on.
  30.  
  31. ----------------------------- ENVIRONMENT --------------------------
  32.  
  33. This program was designed to run on an IBM PC/XT/AT or compatible.  It should
  34. also run on the PS/2 without difficulty.  It runs under MS-DOS or PC-DOS
  35. version 2.0 or later.  It is NOT designed to run under OS/2.  In terms of
  36. hardware, it should work on just about anything.
  37.  
  38. ------------------------------- SYNTAX -----------------------------
  39.  
  40. The syntax of DO-FOR is:
  41.  
  42.        DO-FOR [@date] [flags] filemask command
  43.  
  44. The special @DATE flag allows you to process and manipulate files
  45. based on the date stamp of the file.  The format of the @DATE flag
  46. is best shown by examples.  Syntax is:
  47.    @+   = Matches if file date is on or after date specified.
  48.    @-   = Matches if file date is before specified date.
  49.    @C   = Matches if file date is todays date.
  50.  
  51.    DO-FOR @9-18-89 *.* ECHO `f`e `]`] FILELIST.DAT
  52.    will make a listing in FILELIST of all files which have the
  53.    date of 9-18-89
  54.  
  55.    DO-FOR @-10-17-87 *.BAK DEL `f`e
  56.    will delete all files with an extension of .BAK that are
  57.    OLDER than October 10, 1987.
  58.  
  59.    DO-FOR @-C30 *.BAK DEL `f`e
  60.    will delete all files with an extension of .BAK that are
  61.    OLDER than the Current date, MINUS 30 days.
  62.  
  63.    DO-FOR @+3-14-87 *.* ECHO `f`e `]`] FILELIST
  64.    will make a listing in FILELIST of all files that are newer
  65.    than March 14, 1987.
  66.  
  67.  
  68. The "flags" parameter narrows the match criteria, and allows a more
  69.    flexible selection than just the DOS wildcards.
  70.  
  71.    Current flags supported are:    /a  /r  /h  /s  /f
  72.    These flags indicate the file attribute of a possible match.
  73.    (File attributes are:  Archive  Read-Only  Hidden  System)
  74.  
  75.    The /f parameter allows DO-FOR to take the file names from another
  76.    text file, instead of using the DOS wildcard match.  See the documentation
  77.    below for more information on the /f flag.
  78.  
  79.    Each flag should be followed by either a plus + sign or a minus - sign
  80.    to indicate which files should be counted as a wildcard match.
  81.  
  82.       /a+     means only files with the archive bit ON will be selected
  83.       /a-     means only files with the archive bit OFF will be selected
  84.       /r+     means only files marked "read-only" will be selected
  85.       /r-     means only the files which are NOT "read-only" will be selected
  86.       /h+     means only the files which are hidden will be selected
  87.       /h-     means only NON-hidden files will be selected
  88.       /s+     means only the files which are system files will be selected
  89.       /s-     means only NON-system files will be selected
  90.  
  91.  
  92. The /f parameter will allow DO-FOR to get the list of filenames to operate
  93. on from a text file, instead of from DOS.
  94.  
  95.   This will allow you to customize what files DO-FOR will operate on even
  96.   further than with the DOS wildcards and other DO-FOR flags.
  97.  
  98.   Example:  The file   C:\ACCT\CUST.TXT   contains a list of files which
  99.   need to be backed up every day.
  100.  
  101.   The command:  DO-FOR /f C:\ACCT\CUST.TXT  COPY `f`e A:`f`e
  102.   will parse through that list and copy any filenames it finds there to
  103.   the floppy in Drive A.
  104.  
  105.   This parameter may be used with all the other parameters as well.
  106.   For example:
  107.   The command:  DO-FOR /a+ /f C:\ACCT\CUST.TXT COPY `f`e A:`f`e
  108.   will do the same as the previous example, but ONLY those files which have the
  109.   archive bit set will be copied.
  110.  
  111.  
  112.  
  113. The following substitutions can be made in "command"
  114.     `f will be replaced by the filename without extension.
  115.     `e will be replaced by a period and the extension
  116.     `d will be replaced by the drive (with colon and backslash)
  117.     `p will be replaced by the filepath (with trailing backslash)
  118.     `[ will be replaced by the < sign
  119.     `] will be replaced by the > sign
  120.     `^ will be replaced by the | sign
  121.     `` will be replaced by a single ` character
  122.  
  123. Please note that the ` character is a BACKWARDS apostrophe character
  124.  
  125.                --------------------------------------
  126. ERRORLEVEL responses:
  127.  
  128.   If you run DO-FOR without any parameters, it gives a synopsis of the
  129.   command syntax, and exits with an ERRORLEVEL of 255.
  130.  
  131.   If you run DO-FOR using the @DATE option, and DO-FOR cannot understand
  132.   the date you entered, OR if the date is invalid (like February 29 in a
  133.   non-leap year) then DO-FOR will exit with an explanatory message and an
  134.   ERRORLEVEL of 1.
  135.                    ------------------------------------
  136.  
  137. CAUTIONS:
  138.  
  139. 1)  Please note (as explained in the "re-direction" section below) that
  140.   you should not use a disk-optimizing program WHILE OUTPUT IS BEING
  141.   RE-DIRECTED TO A FILE, or cross-linking of file clusters can occur.
  142.  
  143.  
  144. ----------------------------- EXAMPLES -------------------------------
  145.  
  146. DO-FOR C:\DOCS\*.PJ WP `D`P`F`E
  147.   Runs the WP program for eachfile with the .PJ extension found in the
  148.   C:\DOCS\  subdirectory.  (as if you typed   WP C:\DOCS\*.WP  )
  149.  
  150. DO-FOR   C:\DBASE\*.DBF   COPY `d`p`f`e C:\DBASE\`f.BAK
  151.   will make a copy with a .BAK extension for all of the
  152.  .DBF files in the C:\DBASE  subdirectory.
  153.  
  154. DO-FOR  *.DOC  C:\WP50\CONVERT 6 `f`e `f.WP
  155.   will run a CONVERT program for all .DOC files, inserting as the
  156.   second parameter the document name with the extension of .WP
  157.  
  158. DO-FOR  /a+  *.DAT  COPY `f`e  A:\`f`e
  159.   will back up onto the A drive floppy any .DAT files which have the
  160.   archive bit set (have been modified).
  161.  
  162.  
  163. --------------------------------- MORE JUNK --------------------------------
  164.  
  165. For those command lines which require re-direction, instead of including
  166. the > symbol on the DO-FOR command line (which DOS will interpret as re-
  167. directing the output of DO-FOR, not your program)...you can insert the
  168. following two part symbols:
  169.  
  170. `]  will be replaced with the > symbol.
  171. `[  will be replaced with the < symbol.
  172. `^  will be replaced with the | symbol.
  173.  
  174. Please note, this is a backwards apostrophe (ASCII character 96), followed
  175. by a right square bracket, left square bracket, or caret mark.
  176.  
  177. CAUTION: Using a disk-optimizing program while output is being redirected to
  178. a file can cause cross-linkage of file clusters.  This has nothing to do with
  179. DO-FOR, but is true whenever such programs are run.  This caution is being
  180. included here just to save you some headaches.  If you are using such a
  181. program, or any program which *directly* manipulates the File Allocation
  182. Table (FAT) then do NOT re-direct output to a file.  (You can still redirect
  183. output to a device such as NUL or PRN without any problems.)
  184.  
  185. Redirection example:   DO-FOR *.PAS `]`] C:\PASFILES.LST
  186.  
  187.            will create a list (in PASFILES.LST) of all files in the
  188.            current directory which end with a .PAS extension.
  189.  
  190. If you have no idea what I'm talking about with re-direction and piping,
  191. that's OK.  If you haven't found it necessary to learn these DOS tools yet,
  192. you needn't learn them just for DO-FOR.
  193.  
  194.  
  195. ----------------------------- HOW DO-FOR WORKS -----------------------------
  196. ------------------------ (useless technical details) ------------------------
  197.  
  198. DO-FOR was written using Borland's Turbo Pascal, Version 6.0
  199. It also makes use of Bob Ainsbury's excellent shareware function library,
  200. the "TechnoJock's Turbo Toolkit."  (Yes, I registered it, did you?)
  201.  
  202. DO-FOR simply does a FindFirst search for a matching filename, based on the
  203. wildcard you supply.  (or it takes the file names from a list specified by
  204. the /f parameter)  If it finds it, and if it matches any additional flag
  205. criteria, it will add that filename to its list.  It then checks the list
  206. for duplicates, and then it will load a secondary copy of COMMAND.COM and
  207. pass it the command line you have entered, first making any substitutions
  208. as requested in the command line with the ` commands.
  209.  
  210. One former problem which was fixed in Version 2.0 happened if the program
  211. that was executed modified the directory, then the "findnext" function used
  212. by DOS could have been be messed up, and might have "found" a file twice, and
  213. executed the command line twice for that file.
  214.  
  215. The source code for DO-FOR is not available for distribution because
  216.   1) I don't want everyone making fun of my code (once again, I'll admit it).
  217.   2) I don't want to have to comment every line of the source.
  218.   3) It uses several of my own units for date and string handling which I
  219.      do not want released.
  220.   4) I don't want J. Random Dufus to modify (and mess up) the program.
  221.      That's why it's copyrighted.
  222.  
  223.                            - - - - - - - - - - -
  224.  
  225. If you have any questions, problems, or suggestions, please let me know.  If I
  226. can make the program more useful for you, also let me know.
  227.  
  228. Glenn Snow
  229. PO Box 655
  230. Mundelein, IL  60060
  231. (708) 566-4079 (voice only, please)
  232. (708) 566-4083 BBS
  233.  
  234. CIS 72317,2751
  235.  
  236. -------------------------------------------------
  237. Version history
  238.  
  239. 1.0 -- Original DO-FOR, written in Turbo Pascal 4.0  (October, 1989)
  240.        (Yes, I know, I should get Turbo Pascal 5.5, but I haven't gotten
  241.         around to it yet.)
  242.  
  243. 1.1 -- Allows re-direction within command line
  244.  
  245. 1.2 -- Added /q Quiet switch, for an uncluttered screen.
  246.  
  247. 2.0 -- Added an array of filenames (300) processed, so that no duplicates are
  248.        repeated when DOS "findnext" function gets messed up...Isn't DOS fun?
  249.        (Oh, and I finally got Turbo Pascal 6)  (June, 1991)
  250.  
  251.        Also added the ability to parse the filenames from a text file  (the
  252.        /f parameter) for further utility.
  253.        
  254. 2.1 -- Added the /m parameter so that users of 4DOS can avoid the reserved `
  255.        character, and change it to anything they want. (Thanks to Rick Charnes
  256.        for the suggestion)
  257.  
  258. --------------------------- END OF DOCUMENTATION ------------------------
  259.